package com.mjh.zhujianju.service.party.impl;

import com.livew.framework.base.service.impl.BaseServiceImpl;
import com.mjh.zhujianju.dao.party.BuildingExamAnswerMapper;
import com.mjh.zhujianju.model.party.BuildingExamAnswerEO;
import com.mjh.zhujianju.service.party.BuildingExamAnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liuyang
 * @Description: 考试题目
 * @date 2018/8/18 14:19
 */
@Service
public class BuildingExamAnswerServiceImpl  extends BaseServiceImpl<BuildingExamAnswerEO> implements BuildingExamAnswerService {

    @Autowired
    private BuildingExamAnswerMapper buildingExamAnswerMapper;

    public BuildingExamAnswerServiceImpl(BuildingExamAnswerMapper buildingExamAnswerMapper) {
        super(buildingExamAnswerMapper);
    }

    @Override
    public List<BuildingExamAnswerEO> queryBuildingExamAnswerByTopicIds(List<Long> topicIds) {
        return buildingExamAnswerMapper.queryBuildingExamAnswerByTopicIds(topicIds);
    }

    @Override
    public void deleteAllAnswerByIds(List<Long> ids) {
        buildingExamAnswerMapper.deleteAllAnswers(ids);
    }

    @Override
    public void batchSaveAnswers(List<BuildingExamAnswerEO> buildingExamAnswerEOS) {
        buildingExamAnswerMapper.saveAll(buildingExamAnswerEOS);
    }

    @Override
    public int delByPrimaryKey(Long id){
        return buildingExamAnswerMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void delAnswerByPrimaryKey(BuildingExamAnswerEO buildingExamAnswerEO) {
        buildingExamAnswerMapper.updateByPrimaryKey(buildingExamAnswerEO);
    }

    @Override
    public List<BuildingExamAnswerEO> findTopicAnswers(Long topicId) {
        List<BuildingExamAnswerEO> buildingExamAnswerEOS =buildingExamAnswerMapper.selectByTopicId(topicId);
        return buildingExamAnswerEOS;
    }

    @Override
    public void deleteByTopicId(Long topicId) {
        buildingExamAnswerMapper.deleteByTopicId(topicId);
    }
}
